package com.liu.algorithm02;

public class DynamicArrayTest {
    public static void main(String[] args) {
        DynamicArray dynamicArray = new DynamicArray();/*
        dynamicArray.addLast(1);
        dynamicArray.addLast(2);
        dynamicArray.addLast(3);
        dynamicArray.addLast(4);
        dynamicArray.addLast(5);
        for (int i = 0; i < 5; i++) {
            System.out.println(dynamicArray.get(i));
        }
        dynamicArray.foreach((element)-> System.out.println(element));
        for (Integer element : dynamicArray) { // hasNext()  next()
            System.out.println(element);
        }

        dynamicArray.stream().forEach(element -> System.out.println(element));

        int removed = dynamicArray.remove(2);
        System.out.println("删除的元素"+removed);

        dynamicArray.stream().forEach(element -> System.out.println(element));*/

        for (int i = 0; i < 9; i++) {
            dynamicArray.addLast(i + 1);

        }
        dynamicArray.stream().forEach(e -> System.out.println(e));
    }
}
